
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
micromark-util-events-to-acorn
Advanced tools
micromark utility to try and parse events with acorn.
This package is ESM only. In Node.js (version 16+), install with npm:
npm install micromark-util-events-to-acorn
In Deno with esm.sh
:
import {eventsToAcorn} from 'https://esm.sh/micromark-util-events-to-acorn@1'
In browsers with esm.sh
:
<script type="module">
import {eventsToAcorn} from 'https://esm.sh/micromark-util-events-to-acorn@1?bundle'
</script>
import {eventsToAcorn} from 'micromark-util-events-to-acorn'
// A factory that uses the utility:
/** @type {Tokenizer} */
function factoryMdxExpression(effects, ok, nok) {
return start
// …
// …
// Gnostic mode: parse w/ acorn.
const result = eventsToAcorn(this.events.slice(eventStart), {
acorn,
acornOptions,
start: pointStart,
expression: true,
allowEmpty,
prefix: spread ? '({' : '',
suffix: spread ? '})' : ''
})
// …
// …
}
This module exports the identifier eventsToAcorn
.
There is no default export.
The export map supports the development
condition.
Run node --conditions development module.js
to get instrumented dev code.
Without this condition, production code is loaded.
eventsToAcorn(events, options)
events
(Array<Event>
)
— eventsoptions
(Options
)
— configurationResult (Result
).
Options
Configuration (TypeScript type).
acorn
(Acorn
, required)
— typically acorn
, object with parse
and parseExpressionAt
fieldsacornOptions
(AcornOptions
, optional)
— configuration for acorn
start
(Point
, optional)
— place where events startprefix
(string
, default: ''
)
— text to place before eventssuffix
(string
, default: ''
)
— text to place after eventsexpression
(boolean
, default: false
)
— whether this is a program or expressionallowEmpty
(boolean
, default: false
)
— whether an empty expression is allowed (programs are always allowed to be
empty)Result
Result (TypeScript type).
estree
(Program
or undefined
)
— Programerror
(Error
or undefined
)
— error if unparseableswallow
(boolean
)
— whether the error, if there is one, can be swallowed and more JavaScript
could be validThis package is fully typed with TypeScript.
It exports the additional types Acorn
,
AcornOptions
, Options
, and
Result
.
Projects maintained by the unified collective are compatible with all maintained versions of Node.js. As of now, that is Node.js 16+. Our projects sometimes work with older versions, but this is not guaranteed.
These extensions work with micromark
version 3+.
This package is safe.
See contributing.md
in micromark/.github
for ways
to get started.
See support.md
for ways to get help.
This project has a code of conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.
FAQs
micromark utility to try and parse events w/ acorn
The npm package micromark-util-events-to-acorn receives a total of 1,526,641 weekly downloads. As such, micromark-util-events-to-acorn popularity was classified as popular.
We found that micromark-util-events-to-acorn demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.